<%@ taglib prefix="t" tagdir="/WEB-INF/tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<t:wrapper title="Register User">
	<jsp:body>
	<script>
		function onSubmit(form, url, userId) {
			form.action=url;
			form.elements["userId"].value = userId;
		}
	</script>
		<c:choose>
			<c:when test="${not empty listUsers}">
			<form method="get" id="register-user">
			
			<!-- When an email is clicked, this elemnt will contain the id of the user -->
			<input type="hidden" name="userId" />
			
				<table>
				<tr>
					<td>
						<spring:message code="modify_user.userID"/>
					</td>
					<td>
						<spring:message code="modify_user.name_of_user"/>
					</td>
					<td>
						<spring:message code="register_user.email"/>
					</td>
				</tr>
				<c:forEach items="${listUsers}" var="user">
					<tr>
						<td>
							<c:out value="${user.id}" />
						</td>
						<td>
							<c:out value="${user.lastName}" />, <c:out value="${user.firstName}" />
						</td>
						<td>
							<input type="submit" value="${user.email}" onclick='onSubmit(this.form, "/three2learn/start_modify_user", ${user.id})' />
						</td>
						
					</tr>
				</c:forEach>
				</table>
				</form>
			</c:when>
			<c:otherwise>
				<spring:message code="search.users.no_results"/>
			</c:otherwise>
		</c:choose>
	</jsp:body>
</t:wrapper>